package com.bluesky.javawebbrowser.domain.http;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Server {

	public static String get(String urlString) {

		try {
			URL url = new URL(urlString);

			HttpURLConnection urlConnection = (HttpURLConnection) url
					.openConnection();

			BufferedReader in = new BufferedReader(new InputStreamReader(
					urlConnection.getInputStream()));

			StringBuilder sb = new StringBuilder();
			char[] buf = new char[1024];
			while (true) {
				int len =in.read(buf);
				if (len==-1)
					break;

				sb.append(buf,0,len);

			}
			return sb.toString();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
